<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
    public function index(){
        $goods = D('Admin/Model/Goods');
        $cate = D('Admin/Model/Cat');
        $catlist = $cate->field('cat_id,cat_name,parent_id')->select();
        $alist = catList($catlist);
        $this->assign('alist',$alist);

        //热销产品
        $hot = $goods->where(['is_hot'=>1])->limit('0,4')->select();
        $this->assign('hot',$hot);

        //精品推荐
        $best = $goods->where(['is_best'=>1])->limit('0,4')->select();
        $this->assign('best',$best);

        //新品推荐
        $new = $goods->where(['is_new'=>1])->limit('0,4')->select();
        $this->assign('new',$new);

        $this->display();
    }
    public function add(){
        $a = M('Goods');
        var_dump($a->select());

    }
}
